extension UIButton {
    
    struct UIButtonAssociatedClosureClass {
        var eventClosure: (UIButton)->()
    }
    
    private struct UIButtonAssociatedKeys {
        static var eventClosureObj:UIButtonAssociatedClosureClass?
    }
    
    private var eventClosureObj: UIButtonAssociatedClosureClass{
        set{
            objc_setAssociatedObject(self, &UIButtonAssociatedKeys.eventClosureObj, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
            
        }
        get{
            return (objc_getAssociatedObject(self, &UIButtonAssociatedKeys.eventClosureObj) as? UIButtonAssociatedClosureClass)!
        }
    }
    
    open func addYTouchUpInsideTarget(_ action:@escaping (UIButton)->()) {
        let eventObj = UIButtonAssociatedClosureClass(eventClosure: action)
        eventClosureObj = eventObj
        addTarget(self, action: #selector(buttonEventExcuate(_:)), for: .touchUpInside)
    }
    
    @objc private func buttonEventExcuate(_ sender: UIButton){
        eventClosureObj.eventClosure(sender)
    }
}
